package b2.config
{
	public class EquipConfig extends CommonObjConfig
	{
		//攻击加成
		public var attackPointPlus:Array;
		//防御加成
		public var armPointPlus:Array;
		//生命加成
		public var healthPointPlus:Array;
		//暴击率加成
		public var caRatioPlus:Array;
		//能量加成
		public var energyPointPlus:Array;
		//战力
		public var fightPoint:Array;
		//套装号
		public var suitIndex:int;
		//位置
		public var position:int;
		//冷却
		public var cooldown:int;
		//消耗能量
		public var energyCost:Array;
		//所附带技能
		public var skills:Array;
		
		public function EquipConfig(equipXML:XML)
		{
			super(equipXML);
			if (equipXML.attackPointPlus != undefined)
				attackPointPlus = equipXML.attackPointPlus.split(",");
			if (equipXML.armPointPlus != undefined)
				armPointPlus = equipXML.armPointPlus.split(",");
			if (equipXML.healthPointPlus != undefined)
				healthPointPlus = equipXML.healthPointPlus.split(",");
			if (equipXML.caRatioPlus != undefined)
				caRatioPlus = equipXML.caRatioPlus.split(",");
			if (equipXML.energyPointPlus != undefined)
				energyPointPlus = equipXML.energyPointPlus.split(",");
			if (equipXML.fightPoint != undefined)
				fightPoint = equipXML.fightPoint.split(",");
			suitIndex = equipXML.suitIndex;
			position = equipXML.position;
			cooldown = equipXML.cooldown;
			if (equipXML.energyCost != undefined)
				energyCost = equipXML.energyCost.split(",");
			skills = new Array();
			for (var i:int = 0; i < equipXML.skill.length(); i++)
				skills.push(new EnemySkillConfig(equipXML.skill[i]));
		}
		
		public function getDescription(quality:int):String
		{
			var descrip:String = description;
			if (position < 6)
			{
				descrip = "";
				if (attackPointPlus != null)
					descrip += "攻击: <font color='#00AA00'> +" + parseInt(attackPointPlus[quality]) + " </font><br>" ;
				if (armPointPlus != null)
					descrip += "防御: <font color='#00AA00'> +" + parseInt(armPointPlus[quality]) + " </font><br>";
				if (healthPointPlus != null)
					descrip += "生命: <font color='#00AA00'> +" + parseInt(healthPointPlus[quality]) + " </font><br>";
				if (caRatioPlus != null)
					descrip += "暴击率: <font color='#00AA00'> +" + parseInt(caRatioPlus[quality]) + " </font><br>";
				if (energyPointPlus != null)
					descrip += "能量: <font color='#00AA00'> +" + parseInt(energyPointPlus[quality]) + " </font><br>";
			}
			else
			{
				if (skills.length > 1)
				{
					descrip = descrip.replace(/s1ba/, "<font color='#00AA00'> " + parseInt(skills[1].bulletApPlus[quality]) + " </font>");
					descrip = descrip.replace(/s1ev/, "<font color='#00AA00'> " + parseInt(skills[1].effectValue[quality]) + " </font>");
					descrip = descrip.replace(/s1ev2/, "<font color='#00AA00'> " + parseInt(skills[1].effectValue2[quality]) + " </font>");
					descrip = descrip.replace(/s1ed/, "<font color='#00AA00'> " + parseInt(skills[1].effectDuration[quality]) + " </font>");
					descrip = descrip.replace(/s1er/, "<font color='#00AA00'> " + parseInt(skills[1].effectRange[quality]) + " </font>");
					descrip = descrip.replace(/s1ad/, "<font color='#00AA00'> " + parseInt(skills[1].areaDemage[quality]) + " </font>");
				}
				descrip = descrip.replace(/ba/, "<font color='#00AA00'> " + parseInt(skills[0].bulletApPlus[quality]) + " </font>");
				descrip = descrip.replace(/ev/, "<font color='#00AA00'> " + parseInt(skills[0].effectValue[quality]) + " </font>");
				descrip = descrip.replace(/ev2/, "<font color='#00AA00'> " + parseInt(skills[0].effectValue2[quality]) + " </font>");
				descrip = descrip.replace(/ed/, "<font color='#00AA00'> " + parseInt(skills[0].effectDuration[quality]) + " </font>");
				descrip = descrip.replace(/er/, "<font color='#00AA00'> " + parseInt(skills[0].effectRange[quality]) + " </font>");
				descrip = descrip.replace(/ad/, "<font color='#00AA00'> " + parseInt(skills[0].areaDemage[quality]) + " </font>");
				descrip = "作用: " + descrip;
			}
			return descrip;
		}
		
	}
}